#include <bits/stdc++.h>
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
int main()
{
	int n = 0;
	cin >> n;
	
	vector<vector<int>> nums(n,nums(n,0));
	
	int x = 0,y = 0;
	int pos = 0;
	for(int i = 0; i < n*n;i++)
	{
		nums[x][y] = i+1;
		int a = x + dx[pos];
		int b = y + dy[pos];
		
		if(a < 0 || a >= n || b < 0 || b >= n || nums[a][b] != 0)
		{
			pos = (pos + 1)%4;
			a = x + dx[pos],b = x + dy[pos];
		}
		x = a,y = b;
	}
	
	for(int i = 0 ; i < n; i++)
	{
		for(int j = 0; i< n;j++)
		{
			printf("%3d",nums[i][j]);
		}
		
	}
	
	
	
	
	return 0;
}

